<template>
请输入姓名：<input type ="text" v-model="username"/>
<div>姓名是：{{ username }}</div>
请输入密码：<input type="text" v-model="password">
<div>密码是：{{ password}}</div>
请输入第一个数字：<input type="text" v-model.number="num1" />
<br />
请输入第二个数字：<input type="text" v-model.number="num2" />
<br />
<!-- <div>和是：{{num1 +num2 }}</div> -->
 <button @click="add">计算和</button>
 <div>{{ result }}</div>
</template>

<script setup>
import {ref} from "vue";
const username = ref("");
const password = ref("")
const num1 =ref("");
const num2 =ref("");
let result = ref(0);
function add(){
alert("111");
result.value= num1.value + num2.value;
}
</script>